using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using FetCo.Data;
using ADESSA.Business;
using ADESSA.Entities;
using FetCo.Framework;
using FetCo.Web;
using System.IO;

public partial class SearchBuy : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        LoadCat();
        LoadCountry();
    }
    private void LoadCat()
    {
        ddlCat.Items.Clear();
        ddlCat.Items.Add(new ListItem("- Categories -", "0"));
        Criteria cri = new Criteria();
        cri.add(ProductCatColumns.Enable, 1, Condition.EQUAL, Condition.AND);
        cri.add(ProductCatColumns.Parrentid, 0, Condition.EQUAL, Condition.AND);
        ProductCatCollection _ProductCatCollection = ProductCatService.GetProductCatListByParam(ProductCatColumns.ProCateID, OrderDirection.DESC, cri.Criter);
        if (_ProductCatCollection.Count > 0)
        {
            foreach (ProductCat _ProductCat in _ProductCatCollection)
            {
                ddlCat.Items.Add(new ListItem(_ProductCat.Name, _ProductCat.ProCateID.ToString()));
            }
        }
    }
    private void LoadCountry()
    {
        ddlcountry.Items.Clear();
        ddlcountry.Items.Add(new ListItem("- Country -", "0"));
        Criteria cri = new Criteria();
        cri.add(CountryColumns.Enable, 1, Condition.EQUAL, Condition.AND);
        CountryCollection _CountryCollection = CountryService.GetCountryListByParam(CountryColumns.CountryId, OrderDirection.DESC, cri.Criter);
        if (_CountryCollection.Count > 0)
        {
            foreach (Country _Country in _CountryCollection)
            {
                ddlcountry.Items.Add(new ListItem(_Country.Name, _Country.CountryId.ToString()));
            }
        }
    }
}
